﻿using System;
using System.Windows.Forms;
using Sistema.WF.View.Kernel;
using Sistema.Kernel;
using System.Collections.Generic;
using Sistema.Dominio;
using Sistema.Util;


namespace Sistema.WF.View
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {    
            IList<UsuarioInfo> resultado = new Usuario().Listar();
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FRM_login login = new FRM_login();
           
            
            if ( IdentificaLogin(login.Login()) == true)
            {
                Sessao.GetSessao();
                Application.Run(new Kernel.FRM_principal());
            }
            else
            {
                new FRM_login();
                IdentificaLogin(login.Login());
            }
        
           
        
        }

        public static bool IdentificaLogin(UsuarioInfo dados)
        {
            Sessao sessao = new Sessao();
            if (dados.Login.EValido == true)
            {
                sessao.UsuarioLogado = dados;
                return true;
            }
            else return false;//sessao.UsuarioLogado.EValido;

        }
    }
}
